<template>
	<view class="custom-nav-bar">
		<view class="navbar">
			<view class="status-bar" :style="{height:getStatusBarHeight()+'px'}"></view>
			<view class="title-bar" :style="{height:getTitleBarHeight()+'px'}">
				<view class="title">{{title}}</view>
				<view class="search">
					<uni-icons type="search" color="#888" size="18" class="icon" />
					<text class="text">搜索</text>
				</view>
			</view>
		</view>
		<view class="fill" :style="{height:getNavBarHeight()+'px'}">
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	import {
		getStatusBarHeight,
		getTitleBarHeight,
		getNavBarHeight,
	} from '@/utils/system.js'
	defineProps({
		title: {
			type: String,
			default: '标题'
		}
	})
</script>

<style lang="scss" scoped>
	.custom-nav-bar {
		.navbar {
			background:
				linear-gradient(to bottom, transparent, #fff 400rpx),
				linear-gradient(to right, #beecd8, #f4e2d8);
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			z-index: 2;

			.title-bar {
				display: flex;
				padding: 0 30rpx;
				align-items: center;

				.title {
					font-size: 22rpx;
					font-weight: 700;
					color: #000;
					margin-right: 20rpx;
				}

				.search {
					width: 220rpx;
					height: 50rpx;
					border-radius: 60rpx;
					background: rgba(255, 255, 255, .4);
					border: 1px solid rgba(255, 255, 255, .4);
					color: #999;
					font-size: 28rpx;
					display: flex;
					align-items: center;

					.icon {
						margin-left: 15rpx;
					}

					.text {
						padding-left: 10rpx;
					}
				}
			}
		}
	}
</style>